﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EasyPayDemo.WeiPay
{
    public class ExcuteAccRefund : IFunction
    {
        public override void Execute()
        {
            M_AccRefund request = new M_AccRefund();

            request.orgId = WeiPayConfig.orgId;
            request.orgTermNo = WeiPayConfig.orgTermno;
            request.orgMerCode = WeiPayConfig.orgMercode;
            request.signType = WeiPayConfig.SIGN_TYPE_RSA256;

            M_AccRefund.Bizdata dataBean = new M_AccRefund.Bizdata();
            dataBean.oriOrgTrace = "ORG0005320211016071139531569";
            dataBean.transAmt = "1";
            dataBean.oriBizDate = "20211019";

            request.bizData = dataBean;

            var chkStr = WeiPayUtils.GetSignData<M_AccRefund.Bizdata>(dataBean);
            string sign = EncryptionUtil.RSASignJavaBouncyCastle(chkStr.ToString(), WeiPayConfig.PrivateKey, "SHA256withRSA");

            request.sign = sign;
            var result = HttpPost<M_AccRefund>(WeiPayConfig.ApiUrlAccRefund, request);

        }
    }
}
